package org.hhchat.others.toutiao.p2017;

import java.util.*;

/**
 * Created by HMH on 2017/3/30.
 */
public class toutiao02 {
    static class array{
        int a;
        int b;

        boolean isbigger(int x, int y) {
            return x>=a && y>=b;
        }
    }
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int q = scanner.nextInt();
        List<array> arrays = new ArrayList<>();
        int x,y;
        array temp = new array();
        for(int i=0;i<n;i++) {
            temp.a = scanner.nextInt();
            arrays.add(temp);
        }
        for(int i=0;i<n;i++) {
            arrays.get(i).b = scanner.nextInt();
        }
        Collections.sort(arrays, new Comparator<array>() {
            @Override
            public int compare(array o1, array o2) {
                return o1.a>=o2.a?1:-1;
            }
        });
        for(int i=0;i<q;i++) {
            x= scanner.nextInt();
            y = scanner.nextInt();
            System.out.println(find(x, y, arrays));
        }
    }

    private static int find(int x, int y, List<array> arr) {
        int count=0;
        for(int i=0;i<arr.size();i++) {
            if (arr.get(i).isbigger(x,y)) {
                count++;
            }
        }
        return count;
    }
}
